﻿/*---------------------------------------------------------------*/
//  Requirment: Jquery.js
/*---------------------------------------------------------------*/
var JTableScrollConfig = { delay: 2, speed: 20, startDelay: 5, scrollItemCount: 1, pause: false }

function JTableScroll(containerID)
{
    var container = document.getElementById(containerID);
    var config = JTableScrollConfig; var handle = {}; var scrollTimeId = null, pause = false;
    
    var $container = $('#' + containerID);
    var $containerHead = $('#' + containerID + ' thead');
    var $containerBody = $('#' + containerID + ' tbody:last');
    var $containerFoot = $('#' + containerID + ' tfoot');

    var scrollTable = function()
    {
        if (!JTableScrollConfig.pause)
        {
            var $tr = $containerBody.find('tr:first').clone(true);
            $containerBody.find('tr:first').remove();
            $tr.appendTo($containerBody);

            $containerBody.find('tr:odd').removeClass().addClass('odd');
            $containerBody.find('tr:even').removeClass().addClass('even');

        }
    }
    setInterval(scrollTable, config.startDelay * 1000);

    $containerBody.bind('mouseover', function() { JTableScrollConfig.pause = true; });
    $containerBody.bind('mouseout', function() { JTableScrollConfig.pause = false; });
}